﻿@model TDT.Land.Entity.Sys_User
@*@using (@Html.BeginForm("ModifyUser", "Admin", FormMethod.Post))
{*@
<form id="fuser" method="post">
<table class="tbEdit" cellpadding="0" cellspacing="0">
    <tr>
        <th>@Html.Label(Sys_User.FieldName.LoginName.Translate())
        </th>
        <td>@Html.TextBoxFor(m => m.UserName)
        </td>
    </tr>
    <tr>
        <th>@Html.Label(Sys_User.FieldName.UserName.Translate())
        </th>
        <td>@Html.TextBoxFor(m => m.LoginName)
        </td>
    </tr>
    <tr>
        <th>@Html.Label(Sys_User.FieldName.Password.Translate())
        </th>
        <td>@Html.TextBoxFor(m => m.Password)
        </td>
    </tr>
    <tr>
        <th>@Html.Label(Sys_User.FieldName.DateExpiredPass.Translate())
        </th>
        <td>@Html.EditorFor(m => m.DateExpiredPass)
        </td>
    </tr>
    <tr>
        <th>@Html.Label(Sys_User.FieldName.IsActivate.Translate())
        </th>
        <td>
            @Html.EditorFor(m => m.IsActivate)
        </td>
    </tr>
    <tr>
        <th>@Html.Label(Sys_User.FieldName.Email.Translate())
        </th>
        <td>
            @Html.EditorFor(m => m.Email)
        </td>
    </tr>
    <tr>
        <th>@Html.Label(Sys_User.FieldName.PhoneNo.Translate())
        </th>
        <td>
            @Html.EditorFor(m => m.PhoneNo)
        </td>
    </tr>
    <tr>
        <th>@Html.Label(Sys_User.FieldName.Islevel.Translate())
        </th>
        <td>
            @Html.DropDownListFor(m => m.IsLevel, (List<SelectListItem>)ViewBag.select_GroupLevel, new { style = "width:138px" })
           @* @Html.EditorFor(m => m.IsLevel)*@
        </td>
    </tr>
    <tr>
        <td colspan="2" align="center">
            @Html.HiddenFor(m => m.ID)
            @*<input type="button" value="Tạo mới" />*@ <a class="btn_boder btn_save" onclick="onsave()">
                Save</a> <a class="close btn_boder btn_cancel">Cancel</a>
        </td>
    </tr>
</table>
</form>
@*}
*@
<script type="text/javascript">
    function onsave() {
        showLoading();
        $.ajax({ type: 'POST', url: '/Admin/UserAction', data: $('#fuser').serialize(), success: function (response) {

            switch (response) {
                case "01":
                    hideLoading();
                    closePopup();
                    cusAlert("Lưu thành công");
                    window.location.assign("/admin/User_List");
                    break;
                case "00": // Store code ton tai..  
                    hideLoading();                                  
                    cusAlert("Lưu thông tin thất bại");
                    break;
                case "02": // Login name tồn tại
                    hideLoading();
                    cusAlert("Tên đăng nhập đã có vui lòng nhập lai tên khác");
                    break;
                default:
                    hideLoading();
                    break;
            }
        }
        });
}

$(document).ready(function () {
    showPopup('Insert product...');
});    


</script>
